<template>
    <div class="wrapper">
        <div class="content-wrapper">
            <!-- header -->
            <div class="header">
                <div class="header-title">
                    海报设置
                </div>
            </div>
            <!-- /header -->
            <el-form
                v-if="init"
                ref="mainform"
                :model="formData"
                label-position="right"
                status-icon
                :rules="formRule"
                label-width="110px"
                :disabled="false"
                style="padding: 30px"
            >
                <div class="form-unit">
                    <el-form-item
                        class="task-form-item"
                        prop="banner_title"
                        label="banner名称"
                    >
                        <el-input
                            placeholder="请输入banner名称"
                            v-model="formData.banner_title"
                            size="medium"
                            class="task-input"
                        />
                    </el-form-item>
                    <el-form-item
                        class="task-form-item"
                        prop="banner_image"
                        label="banner图片"
                    >
                        <el-upload
                            :show-file-list="false"
                            :http-request="fnUploadImageOfCustomerLogo"
                            :before-upload="beforeUploadImage"
                            accept="image/*"
                            class="upload-demo"
                            drag
                            action="https://jsonplaceholder.typicode.com/posts/">
                            <img
                                v-if="formData.banner_image"
                                :src="formData.banner_image"
                                class="avatar">
                            <i
                                class="el-icon-upload"
                                v-if="!formData.banner_image"/>
                            <div
                                class="el-upload__text"
                                v-if="!formData.banner_image">将文件拖到此处，或<em>点击上传</em></div>
                            <div
                                class="el-upload__tip"
                                slot="tip">
                                尺寸：686*360像素，小于1M，支持jpg、png、jpeg格式
                            </div>
                        </el-upload>
                    </el-form-item>
                    <!-- banner跳转 -->
                    <el-row class='row-flex'>
                        <el-form-item
                            class="task-form-item"
                            label="跳转链接:"
                            prop="app_action"
                        >
                            <el-cascader
                                :props="{ expandTrigger: 'hover' }"
                                :placeholder="setJump"
                                size="medium"
                                :filterable="true"
                                v-model="formData.app_action"
                                :options="linkSelectData"
                                @change="handleChange()"
                                ref="myCascader"
                                style="width:400px"
                            />
                        </el-form-item>
                    </el-row>
                    <el-form-item
                        size="small"
                    >
                        <!-- 外链输入框 -->
                        <div
                            v-for="(item,index) in param"
                            :key="index"
                        >
                            <div v-if="item.type == 'text'">
                                <el-input
                                    placeholder="请输入链接"
                                    style="width: 300px"
                                    v-model="formData.jump_url"
                                    @input="getJump"
                                    clearable
                                >
                                    <template
                                        class="param"
                                        slot="prepend">{{ item.title }}
                                    </template>
                                </el-input>
                                <p style="display:inline-block;color:#999;margin-left:12px">*需要联系技术提供</p>
                            </div>
                        </div>
                        <!-- 外链输入框 -->

                        <!-- 内链选择框 -->
                        <el-form-item
                            size="small"
                        >
                            <div
                                v-for="(item,index) in paramCont"
                                :key="index"
                            >
                                <div
                                    v-if="paramCont.length == 2 "
                                    style="display:flex;marginBottom: 10px"
                                >
                                    <p class="el-select-title">{{ item.title }}</p>
                                    <el-select
                                        v-model="list[index]"
                                        filterable
                                        placeholder="请选择"
                                        @change="getLink"
                                        style="marginLeft: -5px;width:239px"
                                    >
                                        <el-option
                                            v-for="item in options[index]"
                                            :key="item.value"
                                            :label="item.title"
                                            :value="item.value"/>
                                    </el-select>
                                    <p style="display:inline-block;color:#999;margin-left:12px">*需要联系技术提供</p>
                                </div>
                                <div
                                    v-if="item.type == 'select' && paramCont.length == 1 "
                                    style="display:flex;marginBottom: 10px"
                                >
                                    <p class="el-select-title">{{ item.title }}</p>
                                    <el-select
                                        v-model="formData.jump_url"
                                        filterable
                                        placeholder="请选择"
                                        @change="getJump"
                                        style="marginLeft: -5px;width:239px"
                                    >
                                        <el-option
                                            v-for="item in options[index]"
                                            :key="item.value"
                                            :label="item.title"
                                            :value="item.value"/>
                                    </el-select>
                                    <p style="display:inline-block;color:#999;margin-left:12px">*需要联系技术提供</p>
                                </div>
                                <div v-if="item.type == 'text'">
                                    <el-input
                                        placeholder="请输入链接"
                                        style="width: 300px"
                                        v-model="formData.jump_url"
                                        @input="getJump"
                                        clearable
                                    >
                                        <template
                                            class="param"
                                            slot="prepend">{{ item.title }}
                                        </template>
                                    </el-input>
                                    <p style="display:inline-block;color:#999;margin-left:12px">*需要联系技术提供</p>
                                </div>
                            </div>
                        </el-form-item>
                        <!-- 内链输入框 -->
                    </el-form-item>
                    <el-form-item
                        class="task-form-item"
                        prop="showTime"
                        label="展示时间:">
                        <el-date-picker
                            v-model="formData.showTime"
                            type="datetimerange"
                            range-separator="至"
                            size="medium"
                            class="task-input"
                            start-placeholder="开始时间"
                            end-placeholder="结束时间"/>
                    </el-form-item>
                    <el-form-item
                        class="task-form-item"
                        size="small"
                        label="上架状态:">
                        <el-switch
                            v-model="formData.banner_status"
                            active-color="#13ce66"
                            active-text="上架"
                            :active-value="1"
                            :inactive-value="0"
                            inactive-text="下架"/>
                    </el-form-item>
                </div>
                <div class="btn-group">
                    <el-button
                        size="medium"
                        @click="handleCancel"
                    >返回
                    </el-button>
                    <el-button
                        size="medium"
                        type="primary"
                        @click="fnSubmit()"
                    >
                        提交
                    </el-button>
                </div>
            </el-form>
        </div>
    </div>
</template>

<script>
import {back} from "@/mixin/back";

export default {
    mixins: [back],
    data() {
        // 验证二位数组,且数组内元素不为空
        const validateArray = (rule, value, callback) => {
            if (!value) {
                callback(new Error(rule.message));
            } else {
                if (value.length < 2 || !value[0] || !value[1]) {
                    callback(new Error(rule.message));
                    return;
                }
                callback();
            }
        };

        return {
            status: false,
            isType: false,
            prevPage: '',
            checkList: [1, 2],
            authResult: {},
            breadcrumbList: [{title: "APP后台",}, {title: "商城"}, {title: '页面中的banner位'}],
            link_text: '',
            banner_id: '',
            provence: [],
            linkSelectData: [],
            param: [],
            paramCont: [],
            isapp: true,
            setJump: '请选择',
            ifSelect: '',
            action: '',
            options: [],
            type_param: {},
            formData: {
                banner_title: "",
                banner_image: '',
                app_action: '',
                jump_url: '',
                type: 1,
                start_time: 0,
                end_time: 0,
                showTime: [this.fnInitTimeNow(), ''],
                banner_status: 1,
                type_param: '',
                form_name: '',
            },
            // 添加学校权限
            showChooseSchool: false,
            selectedCity: [],
            cities: [],
            searchKey: '',
            // 弹窗当前显示学校集合
            schoolList: [],
            // 当前选中的学校
            selectedSchools: [],
            //所有学校集合
            city_schools: {},
            props: {
                value: 'id',
                label: 'name',
                children: 'children'
            },
            //
            list: [],
            formRule: {
                title: [
                    {required: true, message: '请填写banner名称,不可以为空', trigger: 'change'}
                ],
                jump_url: [
                    {required: true, message: '请输入跳转链接', trigger: 'blur'},
                ],
                image_url: [
                    {required: true, message: 'banner位图片不能为空', trigger: 'change'}
                ],
                showTime: [
                    {required: true, message: '请填写展示时间', trigger: 'blur'},
                    {validator: validateArray, message: '请填写正确的时间', trigger: 'blur'}
                ],
                // app_action: [
                //     { required: true, message: '跳转链接不能为空', trigger: 'change' }
                // ],
                type_param: [
                    {required: true, message: '请选择跳转链接', trigger: 'blur'}
                ]
            },
            submitting: false,
            init: false,
            baseUrl: '',
            sessionTicket: localStorage.getItem('sessionTicket'),
            escape: escape,
        };
    },
    created() {
        this.getappAcion();
    },
    computed: {},
    mounted() {
        this.initPage();
        if (this.$route.query.status) {
            this.status = this.$route.query.status;
        }
    },
    methods: {

        /**
         * @description 页面初始化
         */
        initPage() {
            let query = this.$route.query;

            this.$store.commit('SET_HEADER', [{title: "APP后台"}, {title: '商城'}, {
                title: '海报设置',
                path: '/student/member-poster-list'
            }, {title: query.type === 'edit' ? '编辑海报' : query.type === 'add' ? '新建海报' : '查看海报'}]);

            this.type = query.type;
            // 编辑或查看时
            if (query.type === 'edit' || query.type === 'detail') {
                this.banner_id = query.no;
                this.fnInitBannerInfo();
            } else {
                this.init = true;
            }
        },

        /**
         * app行为数据处理
         */
        getappAcion() {
            let arr = [];
            let param = '';
            let val = '';

            this.$post('/student/app_action%5Cget_cascade_list', {}, resp => {
                if (resp.code == 1) {
                    resp.data.list.map((item, index) => {
                        arr.push({
                            value: item.action,
                            label: item.title,
                            children: []
                        });
                        item.target_list.map((itm, idx) => {
                            val = {
                                target: itm.target,
                                param: []
                            };
                            itm.param_list.map((option, i) => {
                                val.param.push({
                                    param: option.param,
                                    title: option.title,
                                    type: option.form_type
                                });
                            });
                            arr[index].children.push({
                                value: JSON.stringify(val),
                                label: itm.title
                            });
                        });
                    });
                }
                this.linkSelectData = arr;

                //提交数据类型
                // {"action":"link_outer","target":"jump","param":{"url":"11"}}
                // {"action":"app_page","target":"custom_form_custom_scene","param":{"form_no":"fm_72e0ab2ce6c04","scene_key":"222"}}
            });
        },
        /**
         * app链接数据处理
         */
        handleChange() {
            let app_action = this.formData.app_action;
            let obj = JSON.parse(app_action[1]);
            let link = {
                action: '',
                target: '',
                param: {}
            };
            let param = [];

            // console.log(app_action, 'app_action');

            this.formData.form_name = '';
            this.$set(this.formData, 'jump_url', '');

            if (app_action[0] == 'app_page') { //内部链接
                let param_list = obj.param;

                this.param = this.paramCont = this.list = [];

                if (param_list.length == 1) {
                    for (let i in param_list) {
                        param.push(
                            param_list[i]
                        );
                    }
                    this.list = [''];
                } else if (param_list.length == 2) {
                    param_list.map(item => {
                        param.push({
                            type: 'select',
                            param: item.param,
                            title: item.title,
                            target: obj['target']
                        });
                    });
                    this.list = ['', ''];
                }

                this.paramCont = param;

                if (this.paramCont.length == 0) {
                    this.link = {
                        action: app_action[0],
                        target: JSON.parse(app_action[1]).target,
                        param: {}
                    };
                    return;
                }

                this.options = [];
                this.paramCont.map((item, index) => {
                    if (item.type == 'select') {
                        this.$post('/student/app_action%5Cget_param_item_list', {
                            action: 'app_page',
                            target: obj['target'],
                            param: item.param
                        }, resp => {
                            if (resp.code == 1) {
                                if (this.paramCont.length == 1) {
                                    this.options.push(
                                        resp.data.list
                                    );
                                } else if (this.paramCont.length == 2) { // 设置顺序
                                    if (item.param == 'form_no') {
                                        this.options.push(
                                            resp.data.list
                                        );
                                    }
                                    if (item.param == 'scene_key') {
                                        setTimeout(() => {
                                            this.options.push(
                                                resp.data.list
                                            );
                                        }, 200);
                                    }
                                }
                            } else if (resp.code == 0) {
                                this.options = [];
                            }
                        });
                        link.param[[item['param']]] = this.formData.jump_url;
                    }
                    if (item.type == 'text') {
                        link.param[[item['param']]] = this.formData.form_name;
                    }

                    link.action = app_action[0];
                    link.target = obj['target'];
                });
            } else if (app_action[0] == 'link_outer') { //外部链接
                this.paramCont = [];
                this.ifSelect = 'text';
                this.param = obj.param;

                //链接赋值
                link = {
                    action: app_action[0],
                    target: obj['target'],
                    param: {
                        url: this.formData.jump_url
                    }
                };
            } else {
                return;
            }
            this.link = link;

            // console.log(this.link, '111');
        },

        /**
         * @abstract  单链接text_select处理
         */
        getJump(url) {
            let param = {};

            this.$set(this.formData, 'jump_url', url);
            for (let key in this.link['param']) {
                param[key] = url;
            }

            this.link['param'] = param;
            console.log(JSON.stringify(this.link), 'app_action');
        },

        /**
         * @abstract  双链接select处理
         */
        getLink() {
            let param = {};

            //保证param字段不重复，否则值会被覆盖
            this.paramCont.map((item, index) => {
                param[item.param] = this.list[index];
            });

            this.link['param'] = param;
            console.log(JSON.stringify(this.link), 'app_action');
        },

        /**
         * banner数据回显处理
         */
        fnInitBannerInfo() {
            this.$post('/student/shop_banner%5Cget', {
                banner_no: this.banner_id
            }, resp => {
                if (resp.code === 1) {
                    let bannerList = resp.data;

                    if (resp.data.app_action === '') {
                        this.formData = {
                            ...bannerList,
                            showTime: [new Date(bannerList.start_time * 1000), new Date(bannerList.end_time * 1000)],
                            app_action: ''
                        };
                        this.init = true;
                        return;
                    } else {
                        this.formData = {
                            create_time: bannerList.create_time,
                            end_time: bannerList.end_time,
                            banner_image: bannerList.image_url,
                            // sort: bannerList.sort,
                            start_time: bannerList.start_time,
                            status: bannerList.status,
                            banner_status: bannerList.title,

                            showTime: [new Date(bannerList.start_time * 1000), new Date(bannerList.end_time * 1000)]
                        };
                    }

                    //  跳转链接回流
                    if (resp.data.app_action === '') {
                        return;
                    }

                    if (JSON.stringify(JSON.parse(resp.data.app_action).param) == '{}') {
                        this.setUrlData(JSON.parse(resp.data.app_action));
                        this.init = true;
                        return;
                    }

                    let app_action = JSON.parse(resp.data.app_action);
                    let app = [];

                    this.$post('/student/app_action%5Cget_cascade_list', {}, resp => {
                        if (resp.code == 1) {
                            resp.data.list.map(item => {
                                if (app_action.action == 'link_outer') {
                                    item.target_list.map(itm => {
                                        if (itm.target == app_action.target) {
                                            app.push(
                                                app_action.action,
                                                JSON.stringify({
                                                    target: app_action.target,
                                                    param: [{
                                                        param: itm.param_list[0].param,
                                                        title: itm.param_list[0].title,
                                                        type: itm.param_list[0].form_type
                                                    }]
                                                })
                                            );
                                            this.setApp_action(app, itm.param_list[0].title, app_action.param.url, itm.target);
                                        }
                                    });
                                }

                                if (app_action.action == 'app_page') {
                                    let length = Object.keys(app_action.param).length;

                                    app = [];
                                    app.push(
                                        app_action.action, {
                                            target: app_action.target,
                                            param: []
                                        }
                                    );
                                    item.target_list.map((itm, idx) => {
                                        if (itm.target == app_action.target) {
                                            itm.param_list.map((option, i) => {
                                                app[1].param.push({
                                                    param: option.param,
                                                    title: option.title,
                                                    type: option.form_type
                                                });
                                            });
                                        }
                                    });
                                    setTimeout(() => {
                                        if (this.isapp) {
                                            this.setSelect_action(app, length, app_action.param);
                                            this.isapp = false;
                                        }
                                    }, 50);
                                } else {
                                    return;
                                }
                            });
                        }
                    });
                } else {
                    this.$message({
                        type: 'warning',
                        message: resp.msg
                    });
                }
            });
        },

        /**
         * param空回填
         */
        setUrlData(url) {
            this.paramCont = [];
            this.formData.app_action = [
                "app_page",
                JSON.stringify({
                    target: url.target,
                    param: []
                })
            ];
            this.link = {
                action: "app_page",
                target: url.target,
                param: {}
            };
        },

        /**
         * select
         */
        setSelect_action(app, length, url) {
            if (length == 1) {
                let list = JSON.parse(JSON.stringify(app));
                let param = JSON.stringify(app[1]);

                this.paramCont = [{
                    type: list[1].param[0]['type'],
                    title: list[1].param[0]['title']
                }];
                list[1] = param;
                this.formData.app_action = list;
                this.options = [];

                for (let i in url) {
                    if (this.paramCont[0].type == 'select') {
                        this.$post('/student/app_action%5Cget_param_item_list', {
                            action: 'app_page',
                            target: JSON.parse(list[1]).target,
                            param: i
                        }, resp => {
                            if (resp.code == 1) {
                                this.options.push(
                                    resp.data.list
                                );
                            } else if (resp.code == 0) {
                                this.options = [];
                            }
                        });
                    }

                    this.$set(this.formData, 'jump_url', url[i]);
                    this.link = {
                        "action": "app_page",
                        "target": JSON.parse(list[1]).target,
                        "param": {
                            [i]: url[i]
                        }
                    };
                    console.log(this.link, 'aa');
                }
            } else if (length == 2) {
                let data = JSON.parse(JSON.stringify(app));
                let params = JSON.stringify(app[1]);
                let current = [];

                app[1] = params;
                this.formData.app_action = app;
                this.paramCont = [];
                this.list = [];

                if (typeof (data[1].param) == 'object') {
                    data[1].param.map((item, index) => {
                        this.paramCont.push({
                            type: 'select',
                            title: data[1].param[index]['title'],
                            param: item.param,
                            target: data[1].target
                        });
                    });
                }

                this.options = [];
                for (let i in url) {
                    this.$post('/student/app_action%5Cget_param_item_list', {
                        action: 'app_page',
                        target: data[1].target,
                        param: i
                    }, resp => {
                        if (resp.code == 1) {
                            if (i == 'form_no') {
                                this.options.push(
                                    resp.data.list,
                                );
                            }
                            if (i == 'scene_key') {
                                setTimeout(() => {
                                    this.options.push(
                                        resp.data.list,
                                    );
                                }, 150);
                            }
                        } else if (resp.code == 0) {
                            this.options = [];
                        }
                    });
                    this.link = {
                        action: "app_page",
                        target: data[1].target,
                        param: url
                    };
                    this.list.push(url[i]);
                }
            }
            this.init = true;
        },

        /**
         * link_outer
         */
        setApp_action(app, title, url, target) {
            this.formData.app_action = app;
            this.$set(this.formData, 'jump_url', url);
            this.param = [{
                type: 'text',
                title: title
            }];
            this.link = {"action": "link_outer", "target": target, "param": {"url": url}};
            this.init = true;
        },
        // {"action":"app_page","target":"custom_form_custom_scene","param":{"form_no":"fm_5507cab254059","scene_key":"掌大精英可见"}}

        fnInitTimeNow() {
            var timestamp = new Date().getTime();

            return timestamp;
        },

        /**
         * 表单提交
         */
        fnSubmit() {
            if (this.submitting) {
                return;
            }
            this.$refs.mainform.validate(valid => {
                if (valid) {
                    if (this.paramCont.length === 2) {
                        if (this.list[0] === '') {
                            this.$message({
                                type: 'waring',
                                message: '表单不可以为空',
                                center: true
                            });
                            return;
                        } else if (this.list[1] === '') {
                            this.$message({
                                type: 'waring',
                                message: '场景不可以为空',
                                center: true
                            });
                            return;
                        }
                    } else if (this.paramCont.length !== 2) {
                        // if (this.formData.jump_url == '') {
                        //     this.$message({
                        //         type: 'waring',
                        //         message: '链接不可以为空',
                        //         center: true
                        //     });
                        //     return;
                        // }
                    }
                    this.submitting = true;

                    if (this.link === '') {
                        this.handleChange();
                    }

                    let school_filter_school_ids = [];

                    if (Object.keys(this.selectedSchools).length >= 1) {
                        this.selectedSchools.map(item => {
                            school_filter_school_ids.push(
                                JSON.parse(item).id
                            );
                        });
                    }

                    let data = {
                        banner_no: this.banner_id,
                        banner_title: this.formData.banner_title,
                        banner_image: this.formData.banner_image,
                        app_action: JSON.stringify(this.link),
                        start_time: Date.parse(this.formData.showTime[0]) / 1000,
                        end_time: Date.parse(this.formData.showTime[1]) / 1000,
                        banner_status: this.formData.banner_status,
                    };

                    this.$post('/student/shop_vip_banner%5Csave', data, resp => {
                        if (resp.code === 1) {
                            this.banner_id = resp.data.banner_no;
                            this.$message({
                                type: 'success',
                                center: true,
                                message: '操作成功'
                            });
                            this.goBack();
                        } else {
                            this.$message({
                                type: 'warning',
                                center: true,
                                message: resp.msg
                            });
                        }
                        this.submitting = false;
                    });
                }
            });
        },
        /**
         * 上传
         * @param e
         * @param item
         */
        fnUpload(e, item) {
            let timeTmp = new Date().getTime();
            let pic = new FormData();

            pic.append('file', e.file);
            item.uploadTime = timeTmp;
            this.$upload({
                url: '/__local/common%5Cupload',
                data: pic,
                progress: e.onProgress,
                success: resp => {
                    if (item.uploadTime != timeTmp) {
                        return;
                    }
                    if (resp.code == 1) {
                        // 调用组件成功回调,修改样式
                        e.onSuccess(resp.data, {
                            url: resp.data.url
                        }, this.fileList);
                    } else {
                        // 失败后调用组件error回调,删除对应元素
                        e.onError(resp.msg);
                        this.$message({
                            type: 'warning',
                            message: '上传图片失败',
                            center: true
                        });
                    }
                }
            });
        },
        fnUploadImage(e, success, error) {
            let timeTmp = new Date().getTime();
            let pic = new FormData();

            pic.append('file', e.file);
            this.$upload({
                url: '/__local/common%5Cupload',
                data: pic,
                success: resp => {
                    if (resp.code == 1) {
                        success(resp);
                    } else {
                        this.$message({
                            type: 'warning',
                            message: '上传图片失败',
                            center: true
                        });
                        error(resp);
                    }
                }
            });
        },
        fnUploadImageOfCustomerLogo(e) {
            this.fnUploadImage(e, (resp) => {
                this.formData.banner_image = resp.data.url;
            }, (resp) => {
                console.log(resp.msg);
            });
        },

        /**
         * 上传图片之前 图片大小限制
         * @param file
         * @returns {boolean}
         */
        beforeUploadImage(file) {
            let type = ['image/jpeg', 'image/png', 'image/jpg'],
                isType = type.includes(file.type),
                isLt1M = file.size / 1024 / 1024 < 1;

            if (!isType) {
                this.$notify({
                    title: '提示',
                    message: '格式仅支持jpg、jpeg、png',
                    type: 'warning',
                    duration: 2000
                });
                return false;
            }

            if (!isLt1M) {
                this.$notify({
                    title: '提示',
                    message: '图片大小不能超过1M',
                    type: 'warning',
                    duration: 2000
                });
                return false;
            }

            return isType && isLt1M;
        },
        /**
         * 返回列表
         */
        handleCancel() {

            this.$confirm('返回后将不会保存您所修改的内容,是否返回?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$router.push({
                    path: '/student/member-poster-list'
                });
            });
        },
    }
};
</script>

<style lang="less" scoped>
.wrapper {
    width: 100%;

    .content-wrapper {
        display: flex;
        height: calc(100% - 24px);
        flex-direction: column;
        position: relative;
        margin: 12px;
        background: #fff;
        box-sizing: border-box;

        /*header*/

        .header {
            height: 68px;
            padding: 24px;
            box-sizing: border-box;
            box-shadow: 0px -1px 0px 0px #F0F2F5;
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px rgba(233, 233, 233, 1) solid;

            .header-title {
                color: #333333;
                font-size: 20px;
                height: 20px;
                font-weight: 500;
                position: relative;
                margin: 24px 0 24px 12px;

                &::before {
                    content: '';
                    position: absolute;
                    left: -8px;
                    top: -1px;
                    width: 3px;
                    height: 20px;
                    background: #1890FF;
                }
            }
        }

        .avatar {
            width: 100%;
            height: 100%;;
        }

        .margin-top {
            margin-top: 15px;
        }

        .banner-add-wrap {
            background: #fff;
            margin: 15px;
            margin-bottom: 0;
            padding: 30px;
            overflow: auto;
        }

        .form-unit {
            margin-bottom: 40px;
        }

        .form-title {
            font-size: 16px;
            font-weight: 600;
            color: rgba(0, 0, 0, 0.85);
            line-height: 18px;
            padding: 0 10px;
            border-left: 2px solid #1890ff;
            margin-bottom: 20px;
        }

        .task-input {
            width: 400px !important;
        }

        input::-webkit-outer-spin-button,
        input::-webkit-inner-spin-button {
            -webkit-appearance: none;
        }

        input[type="number"] {
            -moz-appearance: textfield;
        }

        .operate-baar {
            width: 100%;
            text-align: center;
            margin-top: 168px;
        }

        .el-select-title {
            display: inline-block;
            color: #909399;
            background: #F5F7FA;
            padding: 0 18px;
            border: 1px solid #DCDFE6;
            border-radius: 4px 0 0 4px;
            border-right: none;
            height: 32px;
            white-space: nowrap;
        }

        .el-icon-circle-plus-outline {
            font-size: 20px;
            line-height: 32px;
            align-items: center;
            color: #20a0ff;
            cursor: pointer;
        }

        .school-list {
            max-height: 310px;
            overflow: auto;

            .empty {
                text-align: center;
                color: #7e8993;
            }
        }

        .submit-btn {
            margin: 30px auto 0;
            display: block;
        }

        .el-tag-school {
            display: flex;
            width: 100%;
            flex-wrap: wrap;
            margin-bottom: 10px;

            .el-tag {
                margin-right: 10px;
                margin-bottom: 10px;
                height: 32px;
                display: flex;
                align-items: center;
            }
        }
    }

    /deep/ .el-upload-dragger {
        width: 400px;
    }

    .btn-group {
        margin-left: 120px;
        padding-bottom: 36px;

        .el-button {
            width: 120px;
            margin: 0 24px;
        }
    }
}

</style>
<style lang="less">
.el-form .form-unit .row-flex .el-form-item__content .el-input__inner::-webkit-input-placeholder {
    color: #606266;
}

.banner-add-wrap {
    .el-checkbox-button {
        margin-right: 10px;
        margin-bottom: 10px;
        border-radius: 0;
    }

    .el-checkbox-button:first-child .el-checkbox-button__inner {
        border-radius: 2px;
    }

    .el-checkbox-button__inner {
        border-left: 1px solid #dcdfe6;
        font-size: 12px;
        font-weight: 400;
        color: rgba(126, 137, 147, 1);
        border-radius: 2px;
        position: relative;
    }

    .el-checkbox-button.is-checked .el-checkbox-button__inner {
        background-color: #fff;
        border: 1px solid rgba(32, 160, 255, 1);
        color: #20a0ff;
        box-shadow: none;
        overflow: hidden;

        &::after {
            content: " ";
            position: absolute;
            bottom: 0;
            right: 0;
            width: 24px;
            height: 18px;
            background-image: url(//cdn.zsdx.cn/admin/images/common/checked.png);
            background-position: center;
            background-size: cover;
            background-repeat: no-repeat;
        }
    }
}
</style>
